def currency_converter():
    """汇率转换主程序"""
    EXCHANGE_RATE = 7.0
    
    def convert(amount, currency):
        """执行货币转换"""
        if currency == "USD":
            return amount * EXCHANGE_RATE, "CNY"
        elif currency == "CNY":
            return amount / EXCHANGE_RATE, "USD"
        else:
            return None, None
    
    while True:
        # 获取用户输入
        user_input = input("请输入金额和货币类型（例如：100 USD）：").strip().upper()
        
        # 解析输入
        try:
            amount, currency = user_input.split()
            amount = float(amount)
        except:
            print("输入格式错误，请重新输入")
            continue
        
        # 执行转换
        result, target = convert(amount, currency)
        
        # 输出结果
        if result:
            print(f"转换结果：{result:.2f} {target}")
        else:
            print("仅支持USD/CNY转换")
        
        # 继续判断
        if input("继续兑换？(Y/N)").upper() != "Y":
            break

if __name__ == "__main__":
    currency_converter()